fix: harden schema properties and add CODE_MAP.md#25
Merged
Conversation
Resolves #22 and #23: harden schema property error handling in Cte, Join, and Select classes. Replace type(s)(...) with s.new(...), use safezip for length validation, add CTE params type validator, and wrap inner schema resolution with error context. Add CODE_MAP.md for AI agent and contributor codebase navigation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add null guard to Join.schema to prevent AttributeError on None schema - Change Join's ValueError to QueryBuilderError for consistent error hierarchy - Use QB_TypeError in CTE params validator instead of plain TypeError - Widen Cte.schema catch to include ValueError from inner schema resolution - Include CTE name in wrapped error message for better diagnostics - Narrow try block around safezip to avoid masking errors from s.new() - Fix CODE_MAP.md inaccuracies: frozen claim, Schema type alias, errors.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add the original exception text to the wrapped QueryBuilderError message so callers inspecting str(e) see the root cause without needing to walk __cause__. Also document why ValueError is in the catch tuple. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cte.schemareturn type toSchema | None, replace manuallencheck +zipwithsafezipfor length validation@params.validatorfor CTE param type checking, wrap inner schema resolution with error context, replacetype(s)(...)withs.new(...)acrossJoin,Select, andCteCODE_MAP.mdfor AI agent and contributor codebase navigationTest plan
uv run pytest tests/test_query.py -x -q— 32/32 pass (covers CTE schema tests from PR fix: register CTE schema correctly when params rename columns #21)safezipimport verified, error messages preserveds.new(...)produces identical results totype(s)(...)for both dict types🤖 Generated with Claude Code